home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / bccapp.zip / STDHDR.H < prev    next >
C/C++ Source or Header  |  1991-09-15  |  3KB  |  127 lines

  1. /*
  2.  *
  3.  * Standard Tags used by all programs.
  4.  *
  5.  * (C) 1990 Vision Software
  6.  *
  7.  * $Id: stdhdr.h 1.2001 91/04/25 15:06:41 pcalvin release $
  8.  *
  9.  * Comments:
  10.  *
  11.  * This file includes tags and macros that are abstract enough to be available
  12.  * for all applications
  13.  *
  14.  * Bugs:
  15.  *
  16.  * None documented
  17.  *
  18.  */
  19. #if (!defined(__STDHDR__))
  20. #define __STDHDR__
  21.  
  22. /*
  23.  * Nearly everyone needs STDIO
  24.  */
  25. #include <stdio.h>
  26.  
  27. /*
  28.  * Pointless redefinitions of C syntax
  29.  */
  30. #define EXTERN extern
  31. #define STATIC static
  32. #define REGISTER register
  33. #define INLINE inline
  34. #define VIRTUAL virtual
  35. #define FRIEND friend
  36. #define FAR far
  37. #define VOID void
  38. #define FLOAT float
  39. #define DOUBLE double
  40. #define INT int
  41. #define UINT unsigned int
  42. #define LONG long
  43. #define ULONG unsigned long
  44. #define CHAR char
  45. #define UCHAR unsigned char
  46. #define CONST const
  47. #define VOLATILE volatile
  48. #define UNION union
  49.  
  50. /*
  51.  * Character based types
  52.  */
  53. typedef INT CCH;                    /* Counter of charactes */
  54. typedef CHAR *PCH;                    /* Pointer to characters */
  55. typedef UCHAR *PUCH;                /* Pointer to unsigned characters */
  56.  
  57. /*
  58.  * String related types
  59.  */
  60. #define cchSzTempMax 255
  61. typedef CHAR SZTEMP[cchSzTempMax];    /* Temporary string manipulation */
  62. typedef CHAR *SZ;                    /* Null terminated strings. */
  63. typedef INT CSZ;                    /* Count of strings.. */
  64. typedef INT DSZ;                    /* Difference between two strings.. */
  65.  
  66. /*
  67.  * Generic types..
  68.  */
  69. typedef INT CL;                        /* Line count */
  70.  
  71. /*
  72.  * Generic Boolean type.
  73.  */
  74. typedef INT BOOL;
  75. STATIC CONST BOOL fFalse = 0;
  76. STATIC CONST BOOL fTrue = 1;
  77.  
  78. /*
  79.  * Nil values for each type
  80.  */
  81. #define Nil 0
  82. STATIC CONST VOID *pvNil = 0;
  83. STATIC CONST FILE *stmNil = 0;
  84. STATIC CONST SZ szNil = 0;
  85. STATIC CONST CCH cchNil = 0;
  86. STATIC CONST CHAR chNil = 0;
  87. STATIC CONST PCH pchNil = 0;
  88. STATIC CONST PUCH puchNil = 0;
  89.  
  90. /*
  91.  * Some Useful ASCII constants
  92.  */
  93. STATIC CONST CHAR chSpace = ' ';
  94. STATIC CONST CHAR chReturn = '\n';
  95. STATIC CONST CHAR chTab = '\t';
  96.  
  97. /*
  98.  * Run-time error detection systems
  99.  */
  100. EXTERN VOID IOError(SZ sz,...);
  101. EXTERN VOID AssertFailed(CL cl,SZ sz);
  102. EXTERN VOID AssertFailedSz(CL cl,SZ sz,SZ szMessage);
  103. /*
  104.  * Debugging is ON
  105.  */
  106. #define __DEBUG__
  107.  
  108. #if (defined(__DEBUG__))
  109. #define Assert(f)                    ((f) ? (VOID) 0 : AssertFailed(__LINE__,__FILE__))
  110. #define AssertSz(f,sz)            ((f) ? (VOID) 0 : AssertFailedSz(__LINE__,__FILE__,sz))
  111. #define Verify(f)                    Assert(f)
  112. #define VerifySz(f,sz)            AssertSz(f,sz)
  113. #define MemoryAssert(f)         AssertSz((f),"Out of memory")
  114. #define PointerAssert(f)        AssertSz((f),"Nil pointer found")
  115. #define NotReached()                AssertSz(fFalse,"Unreachable code")
  116. #else
  117. #define Assert(f)
  118. #define Verify(f)                (f)
  119. #define AssertSz(f,sz)
  120. #define VerifySz(f,sz)            (f)
  121. #define MemoryAssert(f)
  122. #define PointerAssert(f)
  123. #define NotReached()
  124. #endif
  125.  
  126. #endif /* !defined(__STDHDR__) */
  127.